<?php
require_once 'class/config_database.php';
require_once 'class/kamar.php';
require_once 'class/pengguna.php';
$kamar_dao = new Kamar_Dao($host,$user,$pass,$dbnm);
$kamar	   = new Kamar();
$ambil = $_REQUEST['rooms_no'];
$kamar 	= $kamar_dao->get($ambil);

if ( empty($pengguna)){
$pengguna = new Pengguna();
}

switch($kamar->facility){
case "Ekonomi": {$d_facility="Tempat Tidur, Lemari, Meja, Kamar Mandi Luar";
		break;}
case "Bisnis": {$d_facility="Tempat Tidur, Lemari, Meja, Parkir Mobil, TV, Kamar Mandi Dalam";
		break;}
case "Eksekutif": {$d_facility="Tempat Tidur, Lemari, Meja, Parkir Mobil, TV, Kamar Mandi Dalam, AC, WiFi";
		break;}		
}
echo 	"<form method=\"POST\" enctype=\"multipart/form-data\">
		<table width=\"100%\" border=\"0\"><br>
		<tr><td colspan=\"3\" width=\"30%\" valign=\"top\" align=\"right\"><center><font size=\"6\"face=\"Agency FB\">".$kamar->rooms_name.
		"<br><input type=\"hidden\" name=\"rooms_no\" value=\"".$kamar->rooms_no."\"><br>
		<img class=\"well\" src=\"upload/".$kamar->room_figure."\"width=\"400px\"><br></center>"."<form method=\"POST\">
		<input type=\"hidden\" name=\"rooms_no\" value=\"".$kamar->rooms_no."\"></td>
		<tr><td width=\"15%\">Rooms Name 		</td><td width=\"2%\">: </td><td>".$kamar->rooms_name."</td></tr>
		<tr><td>Address 		</td><td>: </td><td>".$kamar->address."</td></tr>
		<tr><td>Rooms Space 	</td><td>: </td><td>".$kamar->roomspace."</td></tr>
		<tr><td>Facility 		</td><td>: </td><td>".$kamar->facility."( ".$d_facility." )</td></tr>
		<tr><td>Price			</td><td>: </td><td>".$kamar->price."</td></tr>
		<tr><td valign=\"top\"><br>Location </td><td valign=\"top\"><br>: </td><td><br>
		<iframe width=\"425\" height=\"350\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"https://maps.google.co.id/maps?q=".$kamar->map_lock."&amp;num=1&amp;hl=id&amp;ie=UTF8&amp;t=m&amp;z=14&amp;ll=".$kamar->map_lock."&amp;output=embed\"></iframe><br /><small><a href=\"https://maps.google.co.id/maps?q=".$kamar->map_lock."&amp;num=1&amp;hl=id&amp;ie=UTF8&amp;t=m&amp;z=14&amp;ll=".$kamar->map_lock."&amp;source=embed\" style=\"color:#0000FF;text-align:left\">Lihat Peta Lebih Besar</a></small>
		<br><br></td></tr><tr><td colspan=\"3\"><center>";
		
		if($pengguna->authority=='mitra'){
		echo "<input type=\"hidden\" name=\"rooms_no\" value=\"".$kamar->rooms_no."\"><input class=\"btn btn-success\" name=\"edit_kamar\" type=\"submit\" value=\"Edit\">&nbsp <input class=\"btn btn-success\" name=\"delete_kamar\" type=\"submit\" value=\"Delete\">";
		}elseif($pengguna->authority=='member'){
		echo "<input type=\"hidden\" name=\"rooms_no\" value=\"".$kamar->rooms_no."\"><input class=\"btn btn-success\" name=\"pesan_kamar\" type=\"submit\" value=\"Pesan Kamar\">&nbsp <input class=\"btn btn-success\" type=\"button\" value=\"Back\" onclick=\"self.history.back()\">";
		}
		else{
		echo "<input class=\"btn btn-success\" type=\"button\" value=\"Back\" onclick=\"self.history.back()\">";
		}
		echo "</center></tr></table></form>";
?>